/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package im.imrobots;

import im.imrobots._cons.ConsEnv;
import im.imrobots._face.IAccount;
import im.imrobots._face.IStatus;
import im.imrobots.v.fetion.Fetion;
import im.imrobots.v.live.Live;
import java.util.HashMap;

/**
 *
 * @author yihaodian
 */
public class IMRobots
{
    private static HashMap<String, IAccount> accounts;

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args)
    {
        accounts = new HashMap<String, IAccount>();
        IAccount account;

        account = new Live();
        account.sign(IStatus.INIT);
        account.sign(IStatus.LINE);
        accounts.put(ConsEnv.IM_LIVE, account);

//        account = new Fetion();
//        account.sign(IStatus.INIT);
//        account.sign(IStatus.LINE);
//        accounts.put(ConsEnv.IM_FETION, account);
    }

    public static void exit(int status)
    {
        for (IAccount acc : accounts.values())
        {
            acc.sign(IStatus.DOWN);
        }
        System.exit(status);
    }

    public static void step(String account, int status)
    {
        IAccount acc = accounts.get(account);
        if (acc != null)
        {
            acc.sign(status);
        }
    }
}
